/************************************************************************************** 
    WFActivityI

    Copyright (C) 2010 =OsDevD=

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation; either version 2.1 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 **************************************************************************************
 */
package ez.workflow.activity;

import java.io.Serializable;
import java.security.Principal;
import java.util.Collection;
import java.util.Date;
import java.util.List;

import ez.workflow.process.WFProcess;
import ez.workflow.transition.WFTransitionLink;

/**
 * 
 * @author OSDevD
 *
 */
public interface WFActivityI extends Serializable {
	
	public static final String ANDBLOCK = "AND-BLOCK";
	public static final String ORBLOCK = "OR-BLOCK";
	public static final String GROUNDBLOCK = "GROUND-BLOCK";
	public static final String CONDITIONBLOCK = "CONDITION-BLOCK";
	public static final String ACTIVITYBLOCK = "ACTIVITY-BLOCK";
	public static final String STARTBLOCK = "START-BLOCK";
	public static final String ENDBLOCK = "END-BLOCK";
	
	/**
     * Return in the same order which were added
     */
    public void addSuccessorWFActivity(WFTransitionLink outcomingWFTransitionLink, WFActivityI step);
    
    /**
     * helper
     * 
     * @param incomingWFTransitionlink
     * @param wfActivity
     */
    public void addPredeccessorWFActivity(WFTransitionLink incomingWFTransitionlink, WFActivityI wfActivity);

    /**
     * Basically Graph edges representation in workflow - outcoming edges to Vertex
     */
    public Collection getAvailableOutcomingWFTransitionLinks();
    
    /**
     * Basically Graph edges representation in workflow - incoming edges to Vertex
     * 
     * @return Collection
     */
    public Collection getAvailableIncomingWFTransitionLinks();

    /**
     */
    public List getErrors();

    /**
     * can run multiple times, Graph edges routing execution 
     */
    public WFTransitionLink execute();

    /**
     * 
     */
    public Principal getActor();

    /**
     * 
     */
    public Date getEndTime();
    
    
    public String getDecisionStatus();

    /**
     * 
     */
    public String getMessageKey();

    /**
     * 
     */
    public Object[] getMessageArguments();


    /**
     * 
     */
    public Date getStartTime();

    /**
     * Gets the WFProcess that is the parent of this WFIActivity.
     * 
     * @return the workflow
     */
    public WFProcess getWorkflowProcess();

    /**
     * 
     */
    public boolean isCompleted();
    
    
 

    /**
     * 
     */
    public boolean isStarted();

    /**
     * 
     */
    public void start();

 
   
    /**
     * 
     * @param outcomingWFTransitionLink
     * @return
     */
    public WFActivityI getSuccessorWFActivity(WFTransitionLink outcomingWFTransitionLink);
    
    /**
     * 
     * @param incomingWFTrannsitionLink
     * @return
     */
    public WFActivityI getPredeccessorWFActivity(WFTransitionLink incomingWFTrannsitionLink);

}
